Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds optional source_tag to User-Agent #16

Merged
merged 10 commits into from
Mar 27, 2024
Merged

Adds optional source_tag to User-Agent #16

merged 10 commits into from
Mar 27, 2024

Conversation

ssmith-pc
Copy link
Contributor

@ssmith-pc ssmith-pc commented Mar 26, 2024

Allows setting source_tag in UserAgent.

Usage:

	client, err := pinecone.NewClient(pinecone.NewClientParams{
		ApiKey: "my-api-key",
		SourceTag: "foo",
	})

@ssmith-pc ssmith-pc marked this pull request as draft March 26, 2024 00:41
@ssmith-pc ssmith-pc changed the title First pass at functional impl for source_tag [DRAFT] First pass at functional impl for source_tag Mar 26, 2024
pinecone/client.go Outdated Show resolved Hide resolved
pinecone/client.go Outdated Show resolved Hide resolved
@ssmith-pc ssmith-pc requested a review from haruska March 26, 2024 00:46
Copy link
Contributor

@haruska haruska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach seems ok. I'd adjust the surface area exposed in the SDK a bit.

internal/util/user_agent.go Outdated Show resolved Hide resolved
pinecone/client.go Show resolved Hide resolved
pinecone/index_connection.go Outdated Show resolved Hide resolved
@ssmith-pc ssmith-pc changed the title [DRAFT] First pass at functional impl for source_tag First pass at functional impl for source_tag Mar 27, 2024
@ssmith-pc ssmith-pc marked this pull request as ready for review March 27, 2024 15:40
@ssmith-pc ssmith-pc changed the title First pass at functional impl for source_tag Adds optional source_tag to User-Agent Mar 27, 2024
Copy link
Contributor

@haruska haruska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Nice unit tests on setting the custom headers in internal.

I'd add tests for creating a Client with and without a SourceTag. Same with creating an IndexConnection off those clients.

pinecone/client.go Outdated Show resolved Hide resolved
@ssmith-pc
Copy link
Contributor Author

I'd add tests for creating a Client with and without a SourceTag. Same with creating an IndexConnection off those clients.

Will do. I was wondering if there is a way to intercept the requests and validate the source tag is set

Copy link

@tdonia tdonia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

pinecone/client.go Outdated Show resolved Hide resolved
@haruska haruska self-requested a review March 27, 2024 18:55
Copy link
Contributor

@haruska haruska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ssmith-pc ssmith-pc merged commit 3eee4fa into main Mar 27, 2024
3 checks passed
@ssmith-pc ssmith-pc deleted the ssmith/attribution branch March 27, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants